package com.shelpe.service.simbaproxy.configuration;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.shelpe.service.simbaproxy.mock.MockFilter;
import com.shelpe.service.simbaproxy.mock.MockProperties;
import com.shelpe.service.simbaproxy.mock.MockResponseSenderFilter;
import com.shelpe.service.simbaproxy.mock.ResponseExceptionFilter;

@Configuration
@Profile("mock")
@EnableConfigurationProperties(MockProperties.class)
public class MockConfiguration {

	@Bean
	public MockFilter mockFilter(MockProperties props){
		MockFilter filter = new MockFilter();
		filter.setMockProperties(props);
		return filter;
	}
	
	@Bean
	public MockResponseSenderFilter mockResponseSenderFilter(){
		return new MockResponseSenderFilter();
	}
	
	@Bean
	public ResponseExceptionFilter responseExceptionFilter(ObjectMapper objectMapper){
		ResponseExceptionFilter filter = new ResponseExceptionFilter();
		filter.setObjectMapper(objectMapper);
		return filter;
	}
}
